import { reactive, toRefs, watch as Watch, computed as Computed } from "vue"

export const data = <T extends object>(data: T) => {
  return toRefs<T>(reactive<T>(data) as T)
}

export const methods = <T extends object>(methods: T) => {
  return methods
}

export const watch = (watchData: any, watchEffect: any) => {
  Object.keys(watchEffect).forEach(key => {
    Watch(watchData[key], watchEffect[key])
  })
}

export const computed = (computed: any) => {
  const computedOject: any = {}
  Object.keys(computed).forEach(key => {
    computedOject[key] = Computed(computed[key])
  })
  return computedOject
}
